package Test03;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class LoginServer {
	public static void main(String[] args) {
		try {
		ServerSocket serverSocket=new ServerSocket(8800);
		Socket socket=serverSocket.accept();
		InputStream is=socket.getInputStream();
		BufferedReader br=new BufferedReader(new InputStreamReader(is));
		String line=br.readLine();
		while (line!=null) {
			System.out.println("我是服务器，客户端登陆信息为："+line);
			line=br.readLine();
			
		}
		String reply="您好，我是服务器，欢迎登陆";
		OutputStream os=socket.getOutputStream();
		os.write(reply.getBytes());
		
		br.close();
		is.close();
		os.close();
		socket.close();
		serverSocket.close();
		}catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
	}

}
